<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:o="http://openfaces.org/">

    <ui:composition template="/template.xhtml">
        <ui:define name="body">
            <h:form>
                <h:panelGroup>
                    <o:dataTable id="tabla" value="#{purchaseController.items}" var="item" border="0" cellpadding="2" cellspacing="0" rules="all"
                                 bodyOddRowStyle="background-color: #ccffff">
                        <f:facet name="noDataMessage">
                            <h:outputText value="There are no data" />
                        </f:facet>>
                        <o:singleRowSelection rowData="#{purchaseController.selected}">
                        </o:singleRowSelection>
                        <f:facet name="header">
                            <h:panelGrid columns="8" styleClass="panel_boton"> 
                                <h:outputText value="#{bundle.ListPurchaseTitle}" styleClass="titulo"></h:outputText>
                                <h:messages id="msgs"
                                            errorStyle="color: red; background-color: #FF9797" 
                                            infoStyle="color: green; background-color: #99ff99 "/>
                                <h:commandButton action="#{purchaseController.prepareCreate}" title="#{bundle.CreatePurchaseTitle}"
                                                 image="/resources/img/nuevo.png">
                                </h:commandButton>
                                <h:commandButton action="#{purchaseController.prepareEdit}" title="#{bundle.EditPurchaseTitle}"
                                                 image="/resources/img/modificar.png">
                                </h:commandButton>                            
                                <h:commandButton action="#{purchaseController.prepareView}" title="#{bundle.ViewPurchaseTitle}"
                                                 image="/resources/img/consultar.png">
                                </h:commandButton>                            
                                <h:commandButton action="#{purchaseController.previous}" value="#{bundle.Previous} #{purchaseController.pagination.pageSize}" 
                                                 image="#{purchaseController.pagination.hasPreviousPage ? '/resources/img/anterior.png' : '/resources/img/anteriord.png'}"
                                                 disabled="#{!purchaseController.pagination.hasPreviousPage}">
                                    <f:ajax event="action" render="@form"/>
                                </h:commandButton>
                                <h:outputText value="Page #{purchaseController.pagination.page + 1} of #{purchaseController.pagination.pageCount}"/>
                                <h:commandButton action="#{purchaseController.next}" value="#{bundle.Next} #{purchaseController.pagination.pageSize}" 
                                                 image="#{purchaseController.pagination.hasNextPage ? '/resources/img/siguiente.png' : '/resources/img/siguiented.png'}"
                                                 disabled="#{!purchaseController.pagination.hasNextPage}">
                                    <f:ajax event="action" render="@form"/>
                                </h:commandButton>                                
                            </h:panelGrid> 
                        </f:facet>
                        <o:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListPurchaseTitle_purchaseID}"/>
                            </f:facet>
                            <h:outputText value="#{item.purchaseID}"/>
                        </o:column>
                        <o:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListPurchaseTitle_purchaseDate}"/>
                            </f:facet>
                            <h:outputText value="#{item.purchaseDate}">
                                <f:convertDateTime pattern="MM/dd/yyyy" />
                            </h:outputText>
                        </o:column>
                    </o:dataTable>
                </h:panelGroup>
                <br />
            </h:form>
        </ui:define>
    </ui:composition>
</html>
